package nl.utwente.fmt.vertalerbouw.tarrh.encoder;

/**
 * Class to hold all data related to variable entries in the encoder.
 */
public class EncoderVariableEntry {
	private final boolean isMemberVariable;
	private final int register;
	private final EncoderClassEntry type;
	private final String variableName;

	/**
	 * Construct a new variable entry with specified type, register and variable
	 * name.
	 * 
	 * @param type
	 *            the type of the variable.
	 * @param register
	 *            the register containing the value of this variable.
	 * @param isMemberVariable
	 *            true if this entry represents a member variable.
	 * @param variableName
	 *            the variable name of this variable.
	 */
	public EncoderVariableEntry(EncoderClassEntry type, int register, boolean isMemberVariable, String variableName) {
		super();
		this.type = type;
		this.register = register;
		this.isMemberVariable = isMemberVariable;
		this.variableName = variableName;
	}

	/**
	 * Get the number of the register containing the value of this variable, if
	 * this entry does not represent a member variable.
	 * 
	 * @return the number of the register containing the value of this variable.
	 */
	public int getRegister() {
		return register;
	}

	/**
	 * Get the type of the variable represented by this entry.
	 * 
	 * @return the type of the variable.
	 */
	public EncoderClassEntry getType() {
		return type;
	}

	/**
	 * Get the name of the variable represented by this entry.
	 * 
	 * @return the name of this variable.
	 */
	public String getVariableName() {
		return variableName;
	}

	/**
	 * Returns true if the variable represented by this entry is a member
	 * variable.
	 * 
	 * @return true if this variable is a member variable, false otherwise.
	 */
	public boolean isMemberVariable() {
		return isMemberVariable;
	}
}
